package com.example.administrator.zhjt.util;

import com.example.administrator.zhjt.adapter.EnvironmentAdapter;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/5/16 0016.
 */

public class DataStack extends ArrayList<EnvironmentAdapter.Bean>{

        public static final int MAX_SIZE=12;

        public boolean push(EnvironmentAdapter.Bean bean){
            if (size()>=MAX_SIZE){
                return false;
            }
            return super.add(bean);
        }

        public int getLastItemPosition(){
            int position=size()-1;
            return position<0 ?0:position;
        }

        public EnvironmentAdapter.Bean pop(){
            return remove(getLastItemPosition());
        }

}
